import { post } from '../http'
// import store from '@/store'

// 查询列表
export const getTIRCarriage = ({
  tirgms = '',
  currentPage = 1,
  pageSize = 30
}) => {
  return post('/FTKJWLHYPT/Plan/GetTirCarriage', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          tirNum: tirgms
        }
      },
      Orderbys: {},
      PageIndexs: {
        FTKJWLHYPT: String(currentPage)
      },
      PageSizes: {
        FTKJWLHYPT: String(pageSize)
      }
    }
  })
}

// 新增一条数据
export const addTirCarriage = ({
  tirgms, // TIR 编号
  startCustoms = '', // 起运地海关
  organization = '', // 国际组织名称
  owner = '', // 持证人
  startCountry = '', // 起运地国
  endCountry = '', // 目的地国
  carNumber = '', // 公路车辆登记号
}) => {
  return post('/FTKJWLHYPT/Plan/AddTirCarriage', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          tirNum: tirgms,
          tirCustomsStart: startCustoms,
          tirInterorganizationName: organization,
          tirHolder: owner,
          tirCountryStart: startCountry,
          tirCountryEnd: endCountry,
          tirHighwayRegistnum: carNumber
        }
      }
    }
  })
}

// 编辑一条数据
export const editTirCarriage = ({
  tirId,
  startCustoms = '', // 起运地海关
  organization = '', // 国际组织名称
  owner = '', // 持证人
  startCountry = '', // 起运地国
  endCountry = '', // 目的地国
  carNumber = '', // 公路车辆登记号
}) => {
  return post('/FTKJWLHYPT/Plan/UpdateTirCarriage', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          tirId,
          tirCustomsStart: startCustoms,
          tirInterorganizationName: organization,
          tirHolder: owner,
          tirCountryStart: startCountry,
          tirCountryEnd: endCountry,
          tirHighwayRegistnum: carNumber
        }
      }
    }
  })
}

// 删除一条数据
export const delTIRCarriage = ({
  tirId
}) => {
  return post('/FTKJWLHYPT/Plan/DeleteTirCarriage', {
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          tirId
        }
      }
    }
  })
}
